package com.tm.car.config;


import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: CJJ
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "content")
public class ContentConfig implements InitializingBean {
    /**
     * 项目的标题,静态变量,用于全局访问。
     */
    public static String PROJECT_TITLE;

    /**
     * 项目的标题,从配置文件中读取
     */
    private String projectTitle;

    /**
     * 在Spring 容器初始化完成后,将 'projectTitle' 的值赋值给静态变量 'PROJECT_TITLE'.
     *
     * @throws Exception 如果初始化过程中发生错误
     *
     */
    @Override
    public void afterPropertiesSet() {
        PROJECT_TITLE = this.projectTitle;
    }
}
